package com.yizhang.mq.producer;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @Author: yi.zhang
 * @CreateTime: 2025-09-25 17:01:05
 * @Description:
 */
@Service
public class ProducerService {

    @Autowired
    private RocketMQTemplate rocketMQTemplate;

    public void send(String message) {
        // 发送普通消息
        rocketMQTemplate.syncSend("my-topic", message);
        System.out.println("消息发送成功: " + message);
    }
}
